package com.ychs.lawyer.controller;

import com.ychs.lawyer.bean.Case;
import com.ychs.lawyer.bean.Lawyer;
import com.ychs.lawyer.bean.R;
import com.ychs.lawyer.service.CaseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: clh
 * @Date: 2024/08/01/10:47
 * @Description:
 */
@Api(tags = "案件管理")
@RestController
@RequestMapping("/case")
public class CaseController {
    @Autowired
    private CaseService caseService;

    @ApiOperation("获取进行中的案件")
    @GetMapping("/getCaseWhereStatus1")
    public R<?> getCaseWhereStatus1() {
        List<Case> cases1 = caseService.getCaseWhereStatus1();
        return R.success(cases1);
    }
    @ApiOperation("获取已完结的案件")
    @GetMapping("/getCaseWhereStatus2")
    public R<?> getCaseWhereStatus2() {
        List<Case> cases1 = caseService.getCaseWhereStatus2();
        return R.success(cases1);
    }
    @ApiOperation("获取案件律师的所有名字")
    @GetMapping("/getLawyers")
    public R<?> getLawyers() {
        List<Case> lawyers = caseService.getLawyers();
        return R.success(lawyers);
    }

    @ApiOperation("按条件查询案件信息")
    @PostMapping("/selectCaseByConditon")
    public R<?> selectCaseByConditon(@RequestBody Case cases) {
        List<Case> cases2 = caseService.selectCaseByConditon(cases);
        return R.success(cases2);
    }
    @ApiOperation("添加案件")
    @PostMapping("/addCases")
    public R<?> addCases(@RequestBody Case cases) {
        int i = caseService.addCases(cases);
         return i > 0?R.success():R.fail();
    }


}
